//
//  NSString+HTMLEncoding.m
//  Bus
//
//  Created by wangjiajia on 13-8-5.
//  Copyright (c) 2013年 wangjiajia. All rights reserved.
//

#import "NSString+HTMLEncoding.h"

@implementation NSString (HTMLEncoding)
-(NSString *)HTMLEncoding{
    NSString*  newstring=[self stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
    newstring=[newstring stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];
    newstring= [newstring stringByReplacingOccurrencesOfString:@"\"" withString:@"&quot;"];
    return newstring;
    
}
-(NSString *)HTMLDecoding{
   
 NSString*  newstring=[self stringByReplacingOccurrencesOfString:@"\\u0026" withString:@"&"];
    newstring=[newstring stringByReplacingOccurrencesOfString:@"&lt;" withString:@"<"];
    newstring=[newstring stringByReplacingOccurrencesOfString:@"&gt;" withString:@">"];
    newstring= [newstring stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
    newstring=[newstring stringByReplacingOccurrencesOfString:@"\\u0026lt;" withString:@"<"];
    newstring= [newstring stringByReplacingOccurrencesOfString:@"\\u0026quot;" withString:@"\""];
    newstring=[newstring stringByReplacingOccurrencesOfString:@"\\u0026gt;" withString:@">"];
     return newstring;
    
  }
@end
